/*
 * TelephoneCategoryValidator.cpp
 *
 *  Created on: 06 Ιουν 2010
 *      Author: Sartios
 */

#include "TelephoneCategoryValidator.h"
#include "../../../../Utilities/StringTrackers/StringEqualityTracker/StringEqualityTracker.h"

TelephoneCategoryValidator::TelephoneCategoryValidator() {
	MOBILE = new string("mobile");
	HOME = new string("home");
	FAX = new string("fax");
}

TelephoneCategoryValidator::~TelephoneCategoryValidator() {
	delete MOBILE;
	delete HOME;
	delete FAX;
}

/**
 * Very bad code design, but it's simple
 */
bool	TelephoneCategoryValidator::phoneCategoryIsCorrect(const string *phoneCategory){
	bool categoryExists = false;
	if(NULL!=phoneCategory){
		IStringEqualityTracker *stringTracker = new StringEqualityTracker;

		if(true==stringTracker->stringsAreEqual(MOBILE,phoneCategory)){
			categoryExists = true;
		}
		else if(true==stringTracker->stringsAreEqual(HOME,phoneCategory)){
			categoryExists = true;
		}
		else if(true==stringTracker->stringsAreEqual(FAX,phoneCategory)){
			categoryExists = true;
		}
		delete stringTracker;
	}
	return categoryExists;
}
